<template>
    <layout-default name="me" :showHeader="false" :loaded="true">
        <div class="m-info">
            <div class="i-left" v-if="isLogin">
                <div class="l-avatar">
                    <img :src="profile.avatar | avatar" alt="">
                </div>
                <div class="l-synopsis">
                    <div class="s-name" @click="go('/account')">
                        <span>{{profile.nickname}}</span>
                        <i class="iconfont icon-gengduo"></i>
                    </div>
                    <div class="s-statistics">
                        <div class="s-item">
                            <span>文章</span>
                            <span>{{profile.article_count}}</span>
                        </div>
                        <div class="s-item">
                            <span>专题</span>
                            <span>3</span>
                        </div>
                        <div class="s-item">
                            <span>粉丝</span>
                            <span>785</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="i-to-login" v-else @click="go('/login')">
                <div class="l-avatar">
                    <i class="iconfont icon-huabanfuben"></i>
                </div>
                <div class="l-text">
                    <span>注册/登录</span>
                </div>
            </div>
        </div>
        <div class="m-section">
            <div class="s-title">
                <div class="t-left">
                    <span>常用</span>
                </div>
                <div class="t-right">
                    <span>查看更多</span>
                    <i class="iconfont icon-gengduo"></i>
                </div>
            </div>
            <div class="s-content">
                <div class="c-item" @click="go('/follow')">
                    <i class="iconfont icon-guanzhu"></i>
                    <span>关注</span>
                </div>
                <div class="c-item">
                    <i class="iconfont icon-xiaoxi"></i>
                    <span>消息通知</span>
                </div>
                <div class="c-item">
                    <i class="iconfont icon-sixin"></i>
                    <span>私信</span>
                </div>
                <div class="c-item">
                    <i class="iconfont icon-dianzan"></i>
                    <span>点赞过的</span>
                </div>
                <div class="c-item">
                    <i class="iconfont icon-weibiaoti--"></i>
                    <span>作品管理</span>
                </div>
                <div class="c-item">
                    <i class="iconfont icon-fankui"></i>
                    <span>意见反馈</span>
                </div>
            </div>
        </div>
        <div class="m-section">
            <div class="s-title">
                <div class="t-left">
                    <span>系统</span>
                </div>
                <div class="t-right">
                    <span>查看更多</span>
                    <i class="iconfont icon-gengduo"></i>
                </div>
            </div>
            <div class="s-content">
                <div class="c-item" @click="go('/about')">
                    <i class="iconfont icon-iconset0142"></i>
                    <span>关于kyeteo</span>
                </div>
                <div class="c-item" @click="go('/setting')">
                    <i class="iconfont icon-set"></i>
                    <span>设置</span>
                </div>
            </div>
        </div>

    </layout-default>
</template>

<script>
import { mapState } from 'vuex'
export default {
    computed: {
        ...mapState(['isLogin']),
        ...mapState('user', ['profile'])
    }
}
</script>

<style lang="less">
    .me {
        .m-info {
            display: flex;
            height: 206px;
            padding: 0 30px;
            background: white;

            .i-left {
                display: flex;
                align-items: center;

                .l-avatar {
                    width: 124px;
                    height: 124px;
                    border-radius: 62px;
                    overflow: hidden;

                    img {
                        width: 100%;
                        height: 100%;
                    }
                }

                .l-synopsis {
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
                    padding-left: 36px;

                    .s-name {
                        display: flex;
                        align-items: center;
                        span {
                            font-size: 36px;
                            font-weight: 700;
                        }
                        i{
                            font-weight: 700;
                        }
                    }

                    .s-statistics {
                        display: flex;
                        padding-top: 10px;

                        .s-item {
                            display: flex;
                            align-items: center;
                            font-size: 28px;

                            span {
                                &:last-child {
                                    font-weight: 600;
                                }
                            }

                            &:not(:first-child) {
                                margin-left: 20px;
                            }
                        }
                    }
                }
            }
            .i-to-login{
                display: flex;
                align-items: center;
                .l-avatar {
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    width: 124px;
                    height: 124px;
                    border-radius: 62px;
                    background: #f7f7f7;

                    i{
                        font-size: 80px;
                        color:#71777c;
                    }
                }
                .l-text{
                    padding-left: 36px;
                    span{
                        color:#71777c;
                    }
                }
            }
        }

        .m-section {
            margin-top: 15px;
            background: white;

            .s-title {
                display: flex;
                justify-content: space-between;
                align-items: center;
                height: 100px;
                padding: 0 30px;

                .t-left {
                    span {
                        font-size: 36px;
                    }
                }

                .t-right {
                    display: flex;
                    align-items: center;

                    span {
                        color: #71777c;
                    }
                }
            }

            .s-content {
                display: flex;
                flex-wrap: wrap;
                padding: 30px;

                .c-item {
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    justify-content: center;
                    width: 172px;
                    height: 172px;
                    color: #71777c;
                    i{
                        font-size: 50px;
                    }
                    span{
                        font-size: 28px;
                    }
                }
            }
        }
    }
</style>